//
//  DuoAccessoryDevice.h
//  Defines the base class for DuoAccessory
//
//  Created by Lin Xu for Discovery Bay Games on 5/7/12.
//  Copyright (c) 2012 Discovery Bay Games. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <ExternalAccessory/ExternalAccessory.h>

@interface DuoAccessoryDevice : NSObject<NSStreamDelegate>
{
    EAAccessory* _accessory; 
    EASession* _session;
}

//override this in subclasses to customize which runloop streaming occurs, or
//completely change the packet delegate behavior
//include DuoAccessorySubclass.h when subclassing
//defaults to mainRunLoop
- (void) beginListening;
- (void) stopListening;

//the protocol can only be set at initialization time.
- (id) initWithProtocol:(NSString*)protocol;

- (void) initializePacket;

- (void) stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode;


@property (nonatomic, retain, readonly) EAAccessory* EAAccessory;
@property (nonatomic, retain, readonly) EASession* session; 
@property (nonatomic, retain, readonly) NSString* protocol;

@end
